<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/home',function(){
	return view('home');
});

// 加入购物车
Route::post('/cart/add','CartController@add');
Route::get('cart/index','Cartcontroller@index');
//删除购物车
Route::get('/cart/delete','CartController@delete');

//后台登陆
Route::get('/admin/login','CommonController@login');
// 后台登录操作
Route::post('/admin/dologin','CommonController@dologin');

Route::get('/admin/login','CommonController@login');
// 后台登录操作
Route::post('/admin/dologin','CommonController@dologin');
	
// 后台管理组
Route::group(['middleware'=>'login'],function(){
		Route::get('/admin',function(){
			return view('admin');
		});
		// 用户管理s
		Route::controller('/admin/user','UserController');
		// 商品分类
		Route::controller('/admin/cate','CateController');
		//商品管理
		Route::controller('/admin/goods','GoodsController');
		//订单管理
		Route::controller('/admin/order','OrderController');
		// 轮播管理
		Route::controller('/admin/lunbo','LunboController');
		
});

Route::group(['middleware'=>'home'],function(){
	Route::get('/',function(){
		return view('/');
	});
//用户个人信息
Route::controller('/home/user','UserController');

//前台订单页
Route::get('home/order','OrderController@show');

//添加订单
Route::post('home/order/add','OrderController@add');

//订单确认
Route::get('home/order/confirm','OrderController@confirm');

//执行确认订单
Route::post('home/order/doconfirm','OrderController@doconfirm');

//支付完成
Route::get('/payout','OrderController@payout');

//删除订单
Route::get('home/order/delete','OrderController@delete');

// 添加地址
Route::controller('/home/address','AddressController');

	
	// 加入购物车
	Route::post('/cart/add','CartController@add');

	//评价
	Route::controller('/goods/comment','CommentController');

	//确认收货
	Route::get('/receipt/confirm','OrderController@receipt');

	//支付完成
	Route::get('/payout','OrderController@payout');
});

// 前台商品操作
Route::controller('/home/goods','GoodsController');

//商品详情页
Route::get('/home/detail/{id}.html','GoodsController@detail')->where('id','\d+');

// 注册
Route::get('/home/register','RegController@register');
Route::post('/home/register','RegController@doRegister');

Route::get('/home/checkuser','RegController@checkUser');

// 激活
Route::get('/ji','RegController@ji');

// 登录
Route::get('/home/login','RegController@login');
Route::post('/home/login','RegController@dologin');

// 找回密码
Route::get('/home/forget','RegController@forget');
Route::post('/home/forget','RegController@doforget');

Route::get('/home/delUsername','RegController@delUsername');


// 密码重置
Route::get('/home/reset','RegController@reset');
Route::post('/home/reset','RegController@doreset');

// 前台首页
Route::get('/','HomeController@home');

// 活动采集
Route::get('/yougou','CaiController@caiji');

// 天气
Route::get('/weather', 'RegController@dowea');






